// https://iai.sh.cn/problem/919
// 超时
#include <bits/stdc++.h>
using namespace std;
int pos[3'000'000 + 3];
int main() {
  string p, t;
  cin >> p >> t;
  int n = p.size();
  int m = t.size();

  int k = 0;
  while (k < n) {
    k = t.find(p, k);
    if (k == t.npos)
      break;
    else
      pos[k] = 1;
    k++;
  }
  int i = 0;
  while (i < m) {
    if (pos[i] == 0)
      cout << t[i];
    else
      i = i + n;
  }

  return 0;
}